<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <script>
    window.onload=function(){
      var ele = document.getElementsByTagName("input");
      ele[4].onclick = function () {
        var year  = Number(ele[0].value);
        var month  = Number(ele[1].value);
        var day  = Number(ele[2].value);
        var days = 0;//存放最终的结果
        switch(month){
          case 12: days = days + 30;//11月
          case 11: days = days + 31;//10月
          case 10: days = days + 30;//9月
          case 9: days = days + 31;//8月
          case 8: days = days + 31;//7月
          case 7: days = days + 30;//6月
          case 6: days = days + 31;//5月
          case 5: days = days + 30;//4月
          case 4: days = days + 31;//3月
          case 3://2月
            if((year%4==0&&year%100!=0)||year%400==0){
              days = days + 29;
            }else{
              days = days + 28;
            }
          case 2:  days = days + 31;//1月
          case 1:  days = days + day;//当月
        }
        ele[3].value = days;
      }
    }
  </script>
</head>
<body>
  <input type="text">年
  <input type="text">月
  <input type="text">日是当年的第
  <input type="text">天
  <input type="button" value="确定">
  
</body>
</html>